package com.starhub.application.agent.enums;

public enum StreamEventTypeEnum {
    START("start", "开始"),
    TEXT("text", "正常文本"),
    REASONING("reasoning", "深度思考"),
    ERROR("error", "异常"),
    TOOL_CALLS("tool_calls", "工具调用"),
    STOP("stop", "停止"),
    USAGE("usage", "token用量")
    ;
    private final String code;
    private final String description;

    StreamEventTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取枚举实例
     */
    public static StreamEventTypeEnum getByCode(String code) {
        for (StreamEventTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
